admin管理员组

文章数量:1415137

I did this azure ad b2c web api tutorial that get's an authorization token with postman and sends it to the API. But how do I get an authorization token from a react native app? When I create the application, do I choose 'Web App / Web API' or 'Native client'? And is there any examples / resources that I can use? Can I use this sample with Microsoft Authentication Library (MSAL)? Im confused because react native is built with JS but piled to native code.

I did this azure ad b2c web api tutorial that get's an authorization token with postman and sends it to the API. But how do I get an authorization token from a react native app? When I create the application, do I choose 'Web App / Web API' or 'Native client'? And is there any examples / resources that I can use? Can I use this sample with Microsoft Authentication Library (MSAL)? Im confused because react native is built with JS but piled to native code.

Share Improve this question asked Mar 4, 2018 at 22:15 thatsITthatsIT 2,1756 gold badges30 silver badges44 bronze badges 8
  • 1 When you have the question of Web app / API or native, you need to ask this question from yourself: Does this app run on the user's device? If the answer is yes, then the app is native. – juunas Commented Mar 5, 2018 at 7:05
  • A React Native app is native. – juunas Commented Mar 5, 2018 at 7:05
  • I'm currently facing the same problem - did you find any solution? – niceman Commented Apr 28, 2018 at 11:39
  • no i didn't. :/ – thatsIT Commented Apr 28, 2018 at 15:30
  • 1 Hey @thatsIT check this and let me know if it works for you: github./wkh237/react-native-azure-ad – Andres Elizondo Commented May 8, 2018 at 16:53
 |  Show 3 more ments

2 Answers 2

Reset to default 2

Check https://github./GSingh01/ad-b2c-react-native. It uses latest spec from Microsoft and JS based solution thus you don't need to eject from expo.

Assuming you plan to use the login from you RN App to both validate the user is valid and to then request data over Azure hosted API endpoints, you should setup your AD B2C Application to allow both Web\Web API AND Native Client.

If you are OK with using the web-based login from your App which jumps out to the mobile browser and then back to your app, have a look at Visual Studio App Center Auth.

NOTE: App Center Auth has been retired: https://devblogs.microsoft./appcenter/app-center-mbaas-retirement/

If you wish to use your own screens hosted in your RN App, you then will need to follow a JWT authentication example. Details of that would be a separate question though.

本文标签: javascriptAzure Active Directory B2C with react nativeStack Overflow