Skip to content

How can I fetch an access token only when I get a 401 response? #77

Closed Answered by nerdroid23
nerdroid23 asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out! Instead of GetAccessTokenRequest::make()->send()->body(), I had to call GetAccessTokenRequest::make()->send()->json(). body() was returning the token in wrapped in a excess pair of double quotes ""super-secure-token-goes-here"" and json() just returns the plain string "super-secure-token-goes-here".

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@nerdroid23
Comment options

@Sammyjo20
Comment options

@nerdroid23
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Sammyjo20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants