Generic Oauth State string

I have integrated the generic oauth login with AWS Cognito, It’s working. But i have aws cognito access token. How can i get the state code from grafana api?
If i take the state string from api i can set the state string in redirect url.

Please tell me how can i get the state string from grafana api?

You can’t use API for that. Make a request (don’t follow redirects) to: <grafana>/login/generic_oauth and parse state from returned redirect URL.