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

Does this demo work for Azure? #7

Open
hozhang404 opened this issue Oct 27, 2020 · 6 comments
Open

Does this demo work for Azure? #7

hozhang404 opened this issue Oct 27, 2020 · 6 comments

Comments

@hozhang404
Copy link

I try to use this demo on Azure, but some things wrong when I access oauth.azure.authorize_access_token().
It shows that the request dosen't contain the client_secret
Does anyone meet the same issue? Or some demos recommended

@gupta-shrinath
Copy link

Have you set the client_secret in oauth.register?
If so make sure you print it first just to verify

@hsbzzhz
Copy link

hsbzzhz commented Nov 16, 2020

thx for your reply, there is no client_secret when I initiate it:
oauth.register( 'azure', server_metadata_url='https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', client_id='', client_secret='', client_kwargs={ 'scope': 'openid email profile' } )
doesn't work above, but I need to add client_secret like thi,:
token = oauth.azure.authorize_access_token(client_secret='*****')

@gupta-shrinath
Copy link

You have to put the client_secret and client_id in the oauth.register(). You get this client_id and client_secret (it may appear as a different term in provider (Azure)). The demo won't contain the secret because it sensivite information and should be unique to every application.

https://realpython.com/flask-google-login/
This might help you understand though the provider(google) is different the concept remains the same as both use the oauth protocol.

@hsbzzhz
Copy link

hsbzzhz commented Nov 16, 2020

Thx for your reply again.
I think you misunderstood my point. For provider Azure, I have already put client_id and client_secret in the oauth.register(), but It will return an error that the client_secret is missing in the oauth Object.
So I try to inject the secret into the oauth object again, like oauth.azure.authorize_access_token(client_secret='*****'). It works.
but what we expect is the secret is already in oauth when oauth.register, not passing the parameter after initiating it.

@gupta-shrinath
Copy link

Could you provide your code?

@gspycke
Copy link

gspycke commented Jul 30, 2021

Thanks, this really helped. I also needed to add client_id:

token = await oauth.azure.authorize_access_token(
            request,
            client_secret='*******',
            client_id='*******',
        )

I also found it easier to print the OauthError (it told me my request was missing "client_id"):

print("except OAuthError as error: {}".format(error))

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

No branches or pull requests

4 participants