Oauth2.0 Access token user identifier

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
EvgenyT
1 Post
User

1Posts

1Kudos

0Solutions

Oauth2.0 Access token user identifier

Hi guys,

 

We've implemented the Oauth2.0 authorization workflow using latest version (2020.202.0) of MYOB AccountRight API for C#.

 

We need to know MYOB user identifier who has been authorized. Due to MYOB documentation we can obtain it while exchange code for access token as example JSON looks like: 

{
    "access_token": "xxx",
    "token_type": "bearer",
    "expires_in": "1200",
    "refresh_token": "",
    "scope": "CompanyFile",
    "user": {
        "uid": "28_[TRUNCATED_FOR_READABILITY]_5c",
        "username": ""
    }
}

 

So we make call to API this way:

 

 

var handler = new OAuthRequestHandler(MyobSettings.DefaultApiConfiguration);
var request = WebRequest.CreateHttp(MyobSettings.Default.Endpoints.AccessTokenUrl);
var response = await handler.GetOAuthTokensAsync(request, "code");

HttpStatusCode status = response.Item1;
OAuthTokens token = response.Item2;

 

 

The problem is OAuthTokens class doesn't contain property "User". How can we get the currently authorized user identifier ? Probably use some other method that will get the user info ?

 

Thanks in advance,

Evgeny.

1 REPLY 1
Tana
MYOB Moderator
43 Posts
MYOB Moderator
MYOB Moderator

43Posts

92Kudos

3Solutions

Re: Oauth2.0 Access token user identifier

Hi there.

Thank you for reaching out on the forum.

This support note might be of use to you: 
https://apisupport.myob.com/hc/en-us/articles/360000497295-User-Access-Permissions-and-Rights-

 

The below endpoint will display the permissions for the user that is currently logged in. 

{{company_file_uri}}/{{company_file_id}}/CurrentUser



Let me know if this is helpful.
Kind regards


Thanks,
@Tana


MYOB API Specialist


MYOB API Support Centre|MYOB App Marketplace|MYOB AccountRight API Endpoint Doc's



Did my answer help?


Mark it as a Solution

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post