locked
Authenticating CRM Online 2013 using OAuth RRS feed

  • Question

  • Hi,

    I have searched in the internet, but haven't been able to get my hands on some sample C# code where it's shown how to authenticate with CRM 2013 Online using OAuth.

    Any help would be highly appreciated.


    Admin QuikView Solution for CRM 2013


    Monday, June 9, 2014 3:26 PM

All replies

  • Monday, June 9, 2014 3:45 PM
    Moderator
  • Hi Jason,

    Thanks for the link, but I am having some trouble using the code. This is what I am expecting:

    1. Provide username/password initially to authorize against CRM 2013 online. It responds with access token, expiry time and refresh token.

    2. For all consequent requests, provide only access token for authorize against CRM 2013 online.

    3. If access token expires (based on expiry time), use refresh token to get a new access token.

    4. Repeat from step 2.

    Not sure if what I am expecting is possible in CRM 2013 online. I do not have any Azure services, so I cant really use the code in the SDK since it asks to register an app and get the Client Id.

    Any help would be highly appreciated! Thanks!


    Admin QuikView Solution for CRM 2013

    Tuesday, June 10, 2014 7:20 AM
  • You can open an Azure account for free, the Azure Active Directory has no monthly costs (however is required a credit card number to complete the registration)

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Tuesday, June 10, 2014 8:41 AM
  • Hi Guido,

    Is it not possible to use OAuth without creating the App and following the Azure method? I haven't found any example without client id though, so just asking if Azure way is the only way to make OAuth work in CRM 2013 online?

    What I am expecting above (mentioned in the steps); is that not possible?

    Thanks!


    Admin QuikView Solution for CRM 2013

    Tuesday, June 10, 2014 8:45 AM
  • I don't know if currently it is possible to use another way. The sample Jason linked uses a preview NuGet package (that is not anymore updated) and the Microsoft.CRM realm must be configured inside Azure. As stated in the link the sample will be updated to use ADAL http://msdn.microsoft.com/en-us/library/jj554349, but I didn't test this new library yet.

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Tuesday, June 10, 2014 8:54 AM
  • Hi Guido,

    One more problem here is that I am not running Windows 8, so without that the solution wont even open up and asks me to install Windows 8. I tried peeking into the .cs files to check what was being done inside them, and figured out it used some sort of Client Id for OAuth.


    Admin QuikView Solution for CRM 2013

    Tuesday, June 10, 2014 8:59 AM
  • the code is simple, it rely mostly on the NuGet Authentication library included. But you need to have at least Windows 8 and VS 2012 to run the sample.

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Tuesday, June 10, 2014 9:16 AM