Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get Google's OAuth2 to display a mobile friendly approval page?

Tags:

oauth-2.0

I am working on a mobile app that will hit some Google APIs, authenticating using OAuth2.

It's working pretty well but when I navigate to the approval Uri, Google is returning what looks like a full blown desktop app approval page. It doesn't look too bad but I'd prefer to get the stripped down mobile version that you could ask Google's OAuth 1 to display.

(from http://code.google.com/apis/accounts/docs/OAuth_ref.html)

btmpl

(optional) Forces a mobile version of the approval page. The only accepted value is "mobile". This is a Google-specific parameter.

I've tried adding it to the OAuth2 approval Uri but no joy. So if I'm using the Google installed application auth flow, are there any options for indicating that the request is coming from a small screen device?

The oauth endpoint I am using:

https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://localhost&scope=https://www.googleapis.com/auth/userinfo.profile&client_id=XXXXXXX.apps.googleusercontent.com
like image 251
dkackman Avatar asked Nov 14 '22 11:11

dkackman


1 Answers

The OAuth 2.0 URL that you are referring to already has a mobile-friendly version available. However, unlike the OAuth 1.0 URL, there is no URL parameter to force it, instead it uses user-agent detection to display the appropriate version depending on the browser. At least it works fine on my Android device (I haven't tried with any other devices though).

like image 158
Nicolas Garnier Avatar answered Jun 02 '23 20:06

Nicolas Garnier