javascript - Getting the user's google identity from a chrome app -


i thought had things rolling i've discovered have error after calling getauthtoken interactive:false :

oauth2 request failed: service responded error: 'bad request'

'bad request' tells me little. ok, understand i'll need use interative:true (why?) , when attempt that, spawns browser, prompts google login (which enter , real pain because have 2-step authentication), does... nothing... callback never called...

anyone interested in helping me out want see bits manifest.json:

"key": "mii...qab", "oauth2": {     "client_id": "35...-lnf...1pd.apps.googleusercontent.com",     "scopes": [ "identity" ] }, "permissions":[ "identity", "https://accounts.google.com/*", "https://www.googleapis.com/*", "https://*.amazonaws.com/*", "<all_urls>" ], 

you'll want see code in question:

chrome.identity.getauthtoken({ 'interactive': true, 'scopes':['identity'] }, function ( token ) {     if ( chrome.runtime.lasterror ) {         next(chrome.runtime.lasterror);     } else {         next( null, token );     } }); 

or, alternatively:

chrome.identity.getauthtoken({ 'interactive': false }, function ( token ) {     if ( chrome.runtime.lasterror ) {         next(chrome.runtime.lasterror);     } else {         next( null, token );     } }); 

i happy provide other information might helpful in identifying i'm going wrong.

it stated in chrome documentation purpose/meaning of boolean value in interactive object, fetching token may require user sign-in chrome, or approve application's requested scopes. if interactive flag true, getauthtoken prompt user necessary. when flag false or omitted, getauthtoken return failure time prompt required.

now error oauth2 request failed: service responded error: 'bad request'

make sure provide email address , product name in consent screen in creating oauth credentials.

for more information, check thread.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -