Sign in without html

Charles Bell 1 Reputation point
2022-05-25T19:34:04.027+00:00

Building a React Native Expo app. Switching to Cosmos DB from Firebase and trying to migrate authentication.

The previous implementation was username & password with an auth screen I built myself, and then I would pass those to google's a REST endpoint and get back the token. I would like to do the same with Cosmos.

So far, all I've been able to find are implementations that use a webView inside of react native, and have users create microsoft accounts.
Example:https://github.com/shedaltd/react-native-azure-ad-2/blob/master/example/README.md
Which looks like this:
205596-img-2532.png

You hit the button and you get this:

205567-img-2531.png

Which is a webview, running inside React Native. I might be able to remove the Microsoft branding and customize the style, but it will never feel like part of the app.

Is there a REST endpoint or similar I can use to authenticate?

Or at the very least, is there a way to use un/pw that isn't microsoft-branded?

Thanks for your help!

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,587 Reputation points Microsoft Employee Moderator
    2022-05-27T09:07:27.953+00:00

    Hi @Charles Bell You can use the same process as explained here
    The steps are as follows.

    1. On login, the React app contacts Azure App Service to initiate an authentication flow.
    2. Azure App Service performs an Open Auth flow with Azure AD. After the authentication flow completes, the app receives an access token.
    3. The app uses the access token to request a resource token from the resource token broker.
    4. The resource token broker uses the access token to request the user's identity from Azure AD. The user's identity is then used to request a resource token from Cosmos DB, which is used to grant read/write access to the authenticated user's partitioned collection.
    5. The React app uses the resource token to directly access Cosmos DB resources with the permissions defined by the resource token.

    Please let me know if you need any additional information.
    Regards
    Geetha


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.