Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No interfaces for authentication responses #69

Open
luzlab opened this issue Jun 12, 2019 · 5 comments
Open

No interfaces for authentication responses #69

luzlab opened this issue Jun 12, 2019 · 5 comments
Labels
ADO to GitHub automation label Issue caused by core project dependency modules or library

Comments

@luzlab
Copy link

luzlab commented Jun 12, 2019

I noticed there no interfaces for responses when authenticating into the Graph API. I could work on a PR if this isn't on the roadmap.
AB#7039

@muthurathinam
Copy link
Contributor

@luzlab I couldn't get it, you explain the scenario more elaborately ?

@luzlab
Copy link
Author

luzlab commented Jun 26, 2019

When I get an [access token from the identity platform endpoint, I couldn't find a Typescript definition for the response.

It's minor, In my code, I used an inline type assertion to handle this.

const options = {
  form: payload,
  json: true,
  method: 'POST',
  uri: `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`,
};
const { access_token, expires_in }  =(await request(options)) as { access_token: String; expires_in: Number };

I was thinking that it would be easy to add a type for the response...

enum TokenType {
  bearer,
}

 interface Authorization {
   token_type:  TokenType
  expires_in: number
  access_token: string
}

// ... so I could do this instead

const { access_token, expires_in }  =(await request(options)) as MicrosoftGraph.Authorization

@BovineEnthusiast
Copy link

I would also like this, but I was under the impression that the OAuth API is separate from the Graph API, no?

@thesauri
Copy link

I would also find this useful. Authorization is part of the flow in consuming the Graph API and the token is used in subsequent calls.

@ddyett
Copy link

ddyett commented Jun 12, 2020

if you are using msal as the ImplicitMSALAuthenticationProvider in the javascript SDK does, it does provide an AuthResponse interface. this project is about describing responses from the Graph API, and while it is a part of the flow in the javascript SDK the SDK doesn't itself handle the authentication.

@ddyett ddyett added the ADO to GitHub automation label Issue caused by core project dependency modules or library label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO to GitHub automation label Issue caused by core project dependency modules or library
Projects
None yet
Development

No branches or pull requests

5 participants