javascript - How to get access token from the url -
this question has answer here:
i'm getting url after i'm authenticated google
http://localhost:3000/_oauth/google#access_token=ya29.5hxuyol1io8jlegepdznbfkkwu_pc4uodkwg8_1clfyan9agdov1wgpotnqp3s76hasn7y4zww&token_type=bearer&expires_in=3600
how access_token
value url?
i tried solutions in following urls, none of them working
i regex here's regex answer:
var url = 'http://localhost:3000/_oauth/google#access_token=ya29.5hxuyol1io8jlegepdznbfkkwu_pc4uodkwg8_1clfyan9agdov1wgpotnqp3s76hasn7y4zww&token_type=bearer&expires_in=3600', access_token = url.match(/\#(?:access_token)\=([\s\s]*?)\&/)[1];
access_token
is:
ya29.5hxuyol1io8jlegepdznbfkkwu_pc4uodkwg8_1clfyan9agdov1wgpotnqp3s76hasn7y4zww
(directly console)
Comments
Post a Comment