Thank you for visiting our Partner Zone. This area is an exclusive space for MYOB Partners. Find out how to Partner with MYOB.
December 2020
December 2020
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.
January 2021 - last edited January 2021
January 2021 - last edited January 2021
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