react-native-oauth icon indicating copy to clipboard operation
react-native-oauth copied to clipboard

Authenticating towards Azure AD

Open 4xemme opened this issue 8 years ago • 5 comments

I have troubles authenticating with AAD. Did anyone try that?

App crashes at the end of the login process

I've configured a new provider passing auth_version (2.0), authorize_url, access_token_url and callback_url (not sure exactly what we need here)

Then on componentDidMount I configure the manager with my own client ID Later, on a button press, I call authorize with the new provider

I'm presented with all steps where I put my email, get redirected to company login page but when the last step seems to be completed the app crashes

neither reaching then or catch on authorize

4xemme avatar Oct 23 '17 13:10 4xemme

After further investigation I found the following java exception is thrown:

java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.github.scribejava.core.exceptions.OAuthException: Response body is incorrect. Can't extract a '"access_token"\s*:\s*"(\S*?)"' from this: ...

somewhere in the body there's a reference to AADSTS90056 error code that, according to MS, seems to result in 'This endpoint only accepts POST requests'

4xemme avatar Nov 02 '17 16:11 4xemme

Hi there, have you found the solution?

magic-overflow avatar Mar 21 '18 11:03 magic-overflow

No, I gave up and used another package for Azure AD login

4xemme avatar Mar 21 '18 17:03 4xemme

Which package did you end up using for Azure AD? I have had varying success with others but curious to understand which path you ended up going down and how it is working out.

msardi23 avatar Jul 31 '18 11:07 msardi23

In my case, I was using SoapUI to get the access token from Azure website, and I was using the 'Oauth 2 flow' as Authorization code grant initially. Then while retrieving the token i was getting this error, "AADSTS90056: This endpoint only accepts POST requests. Received a GET request.".

Later I changed the dropdown of 'Oauth 2 flow' to 'Client Crendentials Grant'. After this I immediatley got the access token in the soapui without any error.

sreedhar85in avatar Dec 24 '18 05:12 sreedhar85in