1
votes

I'm using the dotnet core 3.1, latest version of ServiceStack and I'm trying to use Google, Microsoft, and Github OAuth with it.

So far with Google and Microsoft, I don't have any issues, however, with Github when I navigate to: /auth and click on 'Github' button.

I'm being redirected to GitHub and presented with the consent page.

Personal user data
Full access

When I click Authorize I'm beeing redirected back to my localhost to: /login#f=AccessTokenFailed

If I login to my Developers Setting I see that 1 user.

So, I'm not sure if this is some workflow issue in ServiceStack maybe, or something with my implementation.

As per my implementation, I have this:

appsettings.json

"oauth.github.Scopes": "user,user:email",
"oauth.github.ClientId" :"xxx",
"oauth.github.ClientSecret": "xxx",

...

Plugins.Add(new AuthFeature(
            () => new AuthUserSession(),
            new IAuthProvider[] {
                new JwtAuthProvider
                {
                    HashAlgorithm = "HS256",
                    RequireSecureConnection = false, 
                    AuthKeyBase64 = "xxx", 
                    CreatePayloadFilter = (payload,session) => {},
                    PopulateSessionFilter = (session, token, req) => {}
                },
                new GoogleAuthProvider(appSettings),
                new GithubAuthProvider(appSettings),
                new MicrosoftGraphAuthProvider(appSettings)                }
        ));

After initial redirect back to my app, when I navigate again to /auth I see I'm not logged in, but when I click again on Github button, I just get redirected back again with the same error message in URL (AccessTokenFailed) (no consent prompt or anything).

Any idea what could be wrong here?

1

1 Answers

0
votes

This issue was due to new GitHub OAuth Apps requiring access tokens to be submitted via Authorization Header which has now been resolved from this commit.

This change is now available from the latest v5.9.3+ that's now available on MyGet.