Account level app - get account id

Hi,

I have an account level oauth app. The idea is this app gets webhooks from different accounts.

When I get a webhook I want to use the access token to do something.

In order to do that I need to know which access token to use based on the account id in the webhook.

I have read that the account_id is in the access token JWT - but when I decode the access token it is not there for me.

When I fetch an access token when the code is redirected to me - how do I know which account it is for?

Or, how do I get the account id to be in the access token as Ive seen in other posts?

Many thanks

Hey @pgp,

Is it possible to provide an example of the webhook and token you’re referring to, to make sure we’re on the same page? Our Webhook payloads will include and account ID, but I’m not sure exactly which token you’re referring to.

Thanks!
Will

Hi @will.zoom

I’m referring to the access token (Bearer token used in API calls) - I was trying to get the account_id from the token, as I read here: Where to find the account ID?

Currently I am doing a call to /v2/users/me to get the account_id - but being able to get it from the token would mean I dont need to do that call or include the scope to make the call.

I have the account ID from the webhook.

Many thanks

Hey @pgp,

Ah, I see—thanks for clarifying!

Please see my post here, which walks through how to decode an access token to get an account ID:

Let me know if this helps,
Will

1 Like