i trying fetch channels of authenticated user, via oauth (rights youtube data) , sign in via app engine. keep getting authorization issue. not happening of yesterday. details of exception:
caused by: com.google.api.client.googleapis.json.googlejsonresponseexception: 401 ok { "code" : 401, "errors" : [ { "domain" : "global", "location" : "authorization", "locationtype" : "header", "message" : "invalid credentials", "reason" : "autherror" } ], "message" : "invalid credentials" }
looking @ api console status of youtube data api, there no issues. causing this? have youtube channel , not having 1 have cause youtube sign issue. not sure what's going on. there other dashboard can @ see if youtube data api experiencing hiccups?
i use following code check user has youtube channel upon login.
try { youtube.channels.list channelrequest = youtubeprovider.get().channels().list("snippet"); channelrequest.setmine(true); // return channels owned authenticated user channellistresponse channellistresponse = channelrequest.execute(); list<channel> channellist = channellistresponse.getitems(); logger.info("youtube channels fetched " + channellist.size()); hasactiveyoutubechannel = channellist.size() > 0; } catch (googlejsonresponseexception e) { ... } the exception thrown , caught, e.statuscode == 401. removing check, use app , can upload , manipulate channel in youtube fine...
sounds wierd im sure isn't big deal, first of double check given password , username.. sounds stupid give headache.also, if try login 3 times wrong pass, have wait time before log in again, , "autherror" time.
after check if use updated token, since if expired "autherror" also. know if using valid token use address:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={access_token}
replace {access_token} token.
keep me updated if help.
Comments
Post a Comment