auth0-example icon indicating copy to clipboard operation
auth0-example copied to clipboard

Response doesn't seem correct for the example

Open trepidity opened this issue 8 years ago • 1 comments

If I use just the example, straight from a clone, it fails. At least when I tried with Google and Facebook. From what I could tell, the response wasn't encoded, but just a JWT.

To get the example to work, I had to add/change response_type, scope, nonce, audience to the startAsync call. Can someone confirm this or why and if so I will submit a PR.

My modified piece

  _loginWithAuth0 = async () => {
    const redirectUrl = AuthSession.getRedirectUrl();
    console.log(`Redirect URL (add this to Auth0): ${redirectUrl}`);
    const result = await AuthSession.startAsync({
      authUrl: `${auth0Domain}/authorize` + toQueryString({
        client_id: auth0ClientId,
        response_type: 'id_token',
        scope: 'openid email profile',
        audience: 'https://example.auth0.com/userinfo',
        nonce: await this.getNonce(),
        redirect_uri: redirectUrl,
      }),
    });

trepidity avatar Jan 29 '18 15:01 trepidity

@trepidity

@OscarKolsrud I've created a pull request with the up-to-date code to also be able to run expo start (supports latest SDK).

Also supports the new request/response structure of auth0.

https://github.com/expo/auth0-example/pull/26

arielweinberger avatar Mar 24 '19 11:03 arielweinberger