The latest version of the SDK touts that it now supports OAuth 2.0 for authentication with the online web services. However, it does not include any sample code, only some vague references and a walk-through for how to register your app with Active Directory. I did find this blog that gives a high level overview, but no code examples:
blogs.msdn.com/.../use-oauth-to-authenticate-with-the-crm-service.aspx
I would like to interface with our online CRM deployment via JavaScript, so I have investigated this pretty thoroughly. Basically, we have and external facing website that is already used to enter leads into our current system. We'd like to keep this site and just feed the leads into CRM instead of our existing system. Since we are rolling out branches, one at a time, the goal would be to have a config setting. And, when a branch "goes live" we'd flip that setting for that branch, and their data would begin feeding into CRM.
So far, I was able get my app registered with CRM and generate my client id. Then using an open source JavaScript OAuth 2.0 client (jso.js), I was able to code an example for requesting a token. When I run the example, it brings up the Sign-In page. I enter my credentials, and it authenticates me. But, then it goes to another page:
Sign in
needs permission to:
You're signed in as: <removed>
Organization:
Application published by:
You should grant permission only if you trust the application publisher with your data, and if you selected this application from a store or site you trust. Ask your admin if you're not sure about granting permission.
OK No thanks
As you can see, there are no permissions there to grant. Also, the organization and published by are blank for some reason as well. If I click "OK" then I get an error:
Sign In
Sorry, but we’re having trouble signing you in.
Something went wrong.
Additional technical information:
Correlation ID: 84d8c02f-1c21-46bf-8a82-eda4785e30d4
Timestamp: 2014-05-07 21:19:25Z
AADSTS50000: There was an error issuing a token.
So, I'm kind of stuck at this point. I can't get the token, which means I then can't make any subsequent web service calls to either the SOAP or REST end points. Has anyone else had any experience with this, or is anyone aware of any available sample code? Any help would be appreciated.