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

how can query string values in javascript?

how value parameters?

using parameter of url in javascript

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)

fiddle


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -