demo-oauth-client
demo-oauth-client copied to clipboard
Does this demo work for Azure?
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
Have you set the client_secret in oauth.register? If so make sure you print it first just to verify
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='*****')
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.
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.
Could you provide your code?
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))