Testing my Ionic app on Android using Auth0 Lock and I’m getting an error from google:
"403. That’s an error
Error: disallowed_useragent
This user-agent is not permitted to man an OAuth authorization request to Google as it is classified as an embedded user-agent… Per our policy, only browsers are permitted to make authorization requests to Google.
…"
The gist of what this does is open up safari via a plugin and then use custom-uri-schemes to fetch back the callback response. This will however, replace the current authentication mechanism of using Lock in favor of the hosted login page which improves the security of your application and offers a painless migration which is future proof.
As this is using PKCE there will be one small change required on your application’s side in Dashboard > Clients > Your Hybrid App Name > Settings. Please change the client type to “Native” this will allow using PKCE for this client.
client
.authorize(options)
.then((authResult) => {
// Handle authResult here instead of lock.on('authenticated'), basically moving your logic here will work
})
.catch((error) => {
// ERROR!
});
Additionally, if you are using refresh-tokens you'll need to make a refresh-token call which is a POST call to /oauth/token which is described at https://auth0.com/docs/tokens/preview/refresh-token#use-a-refresh-token
Optionally, if you would like to use universal links over custom uri schemes you can check the branch universal-links on the repository. There is an example as 02-Universal-Links however this is still experimentally and needs further testing.
Feel free to ping me on this ticket if you need further assistance. We will be realizing a library to make this integration simpler.
Thanks @abhishek.hingnikar for the detailed reply. I can’t say I follow all the changes, yet… but I’ll start looking through the links you posted.
By “hosted login page” are you saying I need to recreate all the functionality of the Lock dialog?
Does this mean I can’t use the same Auth0 code when this runs in the browser as a PWA or in Electron? The Lock approach seemed like it worked everywhere.
I’ll be looking forward to seeing all of this in a single solution.
Hosted Login Page uses Lock itself, so in that front you can write Lock/UI customization here once and it will work the same on all of your applications. Please let me know if you have any further questions.
@abhishek.hingnikar
Using Ionic 1 with Angular 1 and plain vanilla es5, I’m porting over the code from the sample to get my app working with google login.
When it comes to node’s crypto library that is used for .createHash() and .randomBytes() methods, I’m having a struggle finding how to use those or find suitable replacements for the browser (my app does not use ‘require’ statements unfortunately).
Can you help me in pointing me to the right direction?
The createHash and randomBytes use crypto, there is a browserify-crypto module that implements them you should be able to pack that. However, I’ll strongly recommend using a package manager
Now that the auth0 credentials have stopped working for me, I tried changing the client id and secret to my own hoping the issue would be fixed but it doesn’t seem to be fixed yet.
FYI: I’m using the version 0.5.0 of Auth0-Client from here for iOS and Android apps in Xamarin.Forms solution.
Now that the auth0 credentials have stopped working for me, I tried changing the client id and secret to my own hoping the issue would be fixed but it doesn’t seem to be fixed yet.
FYI: I’m using the version 0.5.0 of Auth0-Client from here for iOS and Android apps in Xamarin.Forms solution.