Get the current logged in user using authorization code

Hi @budd.renaud ,

First of all, thanks for your response on below query.

Get Current account details - General - Mitel | Developer Forum

This really helps a lot to make an understanding.

Now I have a new query:

I am able to login successfully and get the authorization code as well, using authorization code I am also able to get the token and using this token able to get the account ID as well.

Now I have authorization code, client ID and Token, but I need the details of current logged in user using these details which I have. I explored the doc but not able to find any API which can help me out in this. Request you to please suggest any appropriate API from which I could be able to get the current logged in user details like name email user ID etc.

Thanks in Advance

Hi @singhcha - I think my assumption was that if you were able to get an authorization code, you would already have the user info because it’s required to get that code in the first place. If you’re using the OICD workflow with the Mitel auth portal though, then that’s probably not the case.

There are two ways to go about getting user information from the token. The first is the manual method, where you use a base64 decoder to decode the token which gives you an AccountId and BearerToken. Decode the BearerToken and it will give you a bunch of info about the user.

The second option is better for coding, since the method used to create tokens could change at any time. Use the GET /token route (Mitel APIs - Authentication) which will use the token from the authentication header to return data about the current user.