Select to view content in your preferred language

How do I get an "access_token" after signing in with OAuth?

557
2
07-27-2018 01:43 PM
MattStayner
Occasional Contributor II

We need to get an "access_token" so we can load private data after signing in using OAuth/AGOL user. How can we do that? 

We have a workflow that works for our web app, it is as follows:

  1. In order to get the token, we hit the endpoint at {host}/sharing/rest/oauth2/token, and as parameters we send the client_id, the code, the redirect_url, and the grant_type of authorization_code.
  2. The returned object has an access_token and a refresh_token, which we retrieve from the returned object.

We see information like esri username and organization ID after we sign in, but no access_token. We also don't see a code, so we can't request it like we do in our web app.

Any help would be appreciated!

Thanks,

Matt 

Tags (2)
0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi Matt,

Can you please provide more detail around why you need to do this with the Survey123 app and your overall workflow. I can understand how or why this may be done with a web app, but not sure I understand the relevant workflow with Survey123 field app?

Phil.

0 Kudos
MattStayner
Occasional Contributor II

I found it. It is oAuthAccessTokenFromAuthCodeRequest in the Portal.qml file. Thanks!