Skip to content

Easy way to query oidc protected rest api using access token? #25

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

You must be logged in to vote

as you guessed, user.token.accessToken gives you the raw access token, but it's up to you how you use it.

I have no idea how restbackend.domain.com is configured, and how it accepts auth parameters, but it should be as easy as setting
'Authorization': 'Bearer ' + token as you did.

the reason we don't provide an easy way for "make a get request using the currently authenticated user"
is because the user might want to use another networking library (e.g. dio).

Internally we even use the access token in the /userinfo request to validate that it actually works
see:

accessToken: actualUser.token.accessToken!,

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by friesoft
Comment options

You must be logged in to vote
2 replies
@ahmednfwela
Comment options

@ahmednfwela
Comment options

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