authlib / authlib/loginpass

Loginpass + Azure - claim validation error for claim "iss"

Open
#65 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
319
Forks
66
PR merge metrics
No merged PRs in 30d

Description

## What I did?
Installed loginpass using pipenv. Used the example to pull in Google and Azure provider. Tried to log in using Azure provider.

The authorization is below, it is incredibly simple. The rest is boilerplate `loginpass` code.

```
def handle_authorization(remote, token, user_info):
printer.pprint(user_info)
return user_info
```

## What should happen?
The flow should complete and I should get the `user_info` dumped to the screen.

## What actually happened?
An error `authlib.jose.errors.InvalidClaimError: invalid_claim: Invalid claim "iss"` is thrown and login does not proceed.

## What I think is the root cause
I think that `loginpass` is actually using OpenID Connect to get the metadata from the server for Azure, which returns the default `iss` claim as a template with the `{tenant}` placeholder that needs to be replaced with a GUID, in my case a static one (as per https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens). Looking at `loginpass` code, specifically `azure.py` at [line 30](https://github.com/authlib/loginpass/blob/master/loginpass/azure.py#L30), this *should work*, but I'm still getting the error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.