How can I get the Token of OAuth?

I am using aws cognito (OAuth) to login. I wanted to get the token that was generated when the user logs in at Reatjs, and make some request for some services at AWS. so, the question is how can I get the token using a grafana plugin?

1 Like

I’m facing the same issue than John. I’ve configured my Grafana server to allow users to connect via our identity platform (using OAuth2), and now I’d like to use the user’s access token in our datasource backend plugin. Is this token exposed somewhere?
Thanks for your help!

I’ve been reading the grafana’s code to know where it keeps the Token it takes from OAuth, and I found it but I think, it’s not saving anywhere.

here is the code where the grafana handles the Token:

I think to do what we want I think we need to use this:
“Enable token authentication”

maybe, we have to prepare an OAuth server that supports “OAuth 2.0 Client Credentials Grant”. and authenticate the puglin request. I’m still investigating about that.,to%20access%20a%20user’s%20resources.

Using the “Enable token authentication” I wrote before I was able to authenticate my request. but I have no way of identifying which user is logged in.
I am asking another question here Is there any way to pass a Global variables on a route?
If I can find a solution for topic above, I think this topic will be solved as well.