Skip to content

Conversation

@nikithauc
Copy link
Contributor

@nikithauc nikithauc commented Jan 28, 2022

This PR is WIP.

fixes #536

@nikithauc nikithauc marked this pull request as draft January 28, 2022 06:49
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for starting this! It's great to see things starting to line up! Lots of work ahead but it's starting to take shape! Two minor comments on my side.

* @callback - The anonymous callback function which takes a single param
*/
export type AuthProvider = (done: AuthProviderCallback) => void;
export interface AuthProviderCallback {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the value of this interface since we already have access token provider in kiota? (or will have soon at least)

* To get the access token
* @returns The promise that resolves to an access token
*/
public getAuthorizationToken(): Promise<string> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, should probably be using the allowed host validator and check for https

* @returns The promise that resolves to an access token
*/
public async getAuthorizationToken(url: string): Promise<string> {
if (!url || !this.allowedHostsValidator.isUrlHostValid(url)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for https

this.updateRequestOptions(options);
const customHosts = this.config?.customHosts;
const customHosts = this.config?.customHosts;
const requestInfo = new RequestInformation();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming we're manipulating a BaseBearerTokenAuthenticationProvider and this provides a property for the access token provider, you shouldn't have to instantiate a request information at all for arbitrary requests

* @public
* @constructor
* Creates an instance of AuthenticationHandler
* @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param name and description needs to be updated

const scopes = ["User.Read", "Mail.Send"];

const graphClient = Client.init({
authenticationTokenProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
authenticationTokenProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),
authenticationProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),


```Shell
npm install @microsoft/msgraph-sdk-javascript-core --save
npm install @microsoft/msgraph-sdk-javascript-types --save-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we still going to chip the type separately at this point?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feeling tells me a core user should have access to the Types. Especially with the work we are doing with the api() method that would reuse the same pattern than the rest of our chained factories. I think a user should be able to benefit from our types without having to download all of our package.

const scopes = ["User.Read", "Mail.Send"];

const graphClient = Client.init({
authenticationTokenProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
authenticationTokenProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),
authenticationProvider: new AzureIdentityAuthenticationProvider(deviceCodeCredentials, scopes),

@baywet
Copy link
Member

baywet commented Mar 18, 2022

isn't this one superseded by #712 at this point? lots of duplicate changes

@nikithauc
Copy link
Contributor Author

The changes here are contains in #712

@nikithauc nikithauc closed this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants