How does Pipedream generate OAuth access tokens?

This topic was automatically generated from Slack. You can find the original thread here.

Cassiano Vellames : Hey guys, how exactly do we get the oauth access tokens? Its not on the app file?

Dylan Sather (Pipedream) : What app?

Cassiano Vellames : Reddit

Dylan Sather (Pipedream) : does this help? pipedream/reddit.app.js at 4c3d04332dfcd91cfaa10583d524220fec8093c0 · PipedreamHQ/pipedream · GitHub

Cassiano Vellames : but how exactly this this.$auth.oauth_access_token is built?

Cassiano Vellames : the app is just using this variable

Cassiano Vellames : you need to do something to login and fill this variable, right?

Dylan Sather (Pipedream) : oh I see, yes that’s all abstracted from the user. We refresh tokens on the user’s behalf using background jobs, and always produce a fresh access token to the source / workflow’s execution environment.

Dylan Sather (Pipedream) : As soon as the user connects a Reddit account in the Pipedream UI and authorizes our access to their account, we get an access / refresh token, and continue refreshing the token from there

Cassiano Vellames : Humm. The Reddit token is returning forbidden, looks like the action that I like to do is not in the scope of the access token

Cassiano Vellames : There is some way I can see the request to get the token?

Cassiano Vellames : I would like to check about the scope of this token

Dylan Sather (Pipedream) : if you visit https://pipedream.com/apps/reddit and scroll to the bottom of the page, you’ll see the current scopes in the Authentication section. If we need to add scopes, just open a new GitHub issue and we’ll get to it.

Normally adding scopes is a non-issue. Sometimes the app considers some scopes “restricted” and we can’t add them for some specific reason (e.g. they only apply to certain types of users with admin accounts)

Cassiano Vellames : Humm, looks like we do not have the scope to write

Cassiano Vellames : I will check the scope name. Can I put this info in my current issue?

Cassiano Vellames : I added here, [ACTION] Reddit new actions · Issue #1466 · PipedreamHQ/pipedream · GitHub Is it okay or you need a new issue?

Dylan Sather (Pipedream) : If you don’t mind, open up a new issue for just the scope change so that we can tackle that separately

Cassiano Vellames : Oh, okay

Dylan Sather (Pipedream) : we’ll take a look at that ASAP

Cassiano Vellames : Should I look new actions meanwhile?