auth0 with social connections Link to heading

auth0 is very handy for scenario where app wants to provide all-in-one login solution (auth0 universal login). For this post, we will just record a niche scenario using google to login in auth0.

social connections Link to heading

You are free to create many social connnections - by having the social account, you will be using that account to login in to auth0 application. You don’t have to recreate account in auth0 application which avoid duplicating efforts.

Google account is one of them, by creating a google social connection, user can use google account to login auth0 application.

“Access Blocked” Link to heading

If you use default auth0 client to request sensitive scopes, you are likely to meet error “Access Blocked”. Actually, default auth0 client will never work for sensitive scopes. In order for it to work, you have to use a custom google app and connect the google app with auth0 app.

Roughly you need to do 4 steps:

  1. Enable APIs in console.google.com. Go to your porject and enable the APIs you wished for, e.g. drive API.

  2. Configure oauth scopes in google project. Go to APIs & Services > OAuth consent screen and explicitly add the necessary scopes, e.g. https://www.googleapis.com/auth/drive.readonly.

  3. Collect your google app client_id and client_secret.

  4. Configure auth0 connection. In auth0 dashboard, go to Authentication > Social and then select Google. There you need to input your google client id and client secret.

With above steps, you should connect 2 parts successfully and it will clear Access Blocked error. But only doing this, it’s likely you meet other errors.

“Auth0 Error 400: redirect_uri_mismatch” Link to heading

It’s likely you still see “Opps, Something is wrong”, and at very end of the page you see status 400 with redirect url mismatch.

It’s because in this scenario that we use google account to log into auth0 application, it’s auth0 client that talking to google. If you don’t set specifically in google app about redirect url, it will fail.

With knowing the reason, the fix will be obvious:

  1. Go to google console, open oauth client used by your auth0 google connection.

  2. Under authorized redirect URIs, add something like https://******.us.auth0.com/login/callback. (**** is your auth0 domain)

By doing above, mismatch URL error should go away.