Identityserver4: Exchange Facebook, Google ,Twitter access token for IdentityServer access token

Created on 18 Sep 2017  路  20Comments  路  Source: IdentityServer/IdentityServer4

Hi,

Is it possible for you guys to have a new endpoint (or use the existing ones) to provide a feature where applications using ResourceOwner flow or Client credential flow could exchange access token for an access token from external providers from facebook, gmail or twitter. I have already done that for my personal project but would be great if you guys can provide it too.

question

Most helpful comment

@leastprivilege here is the link to my repo for exchanging external (facebook, google , twitter) access token for Identity server access token... Looking forward to your feedback.

https://github.com/waqaskhan540/IdentityServerExternalAuth

All 20 comments

This is called an extension grant. We won't include that in our core library - but it is easy to add yourself. Feel free to publish a contrib library or blog post - and we will to it from out docs.

@leastprivilege thanks.. I will share the code and will let you know..

@leastprivilege here is the link to my repo for exchanging external (facebook, google , twitter) access token for Identity server access token... Looking forward to your feedback.

https://github.com/waqaskhan540/IdentityServerExternalAuth

I opened an issue and updated the readme.

@leastprivilege thanks.. will be updating soon..

Hi @waqaskhan540
It looks really great, just what I need for my own project. Does it also support refreshtokens?

@rasmuschristensen for now it doesn't support refresh tokens but it can be added.. I will update you If I see its possible..

@rasmuschristensen I have added support for refresh tokens... I had to set AllowOfflineAccess set to true on client.. include an extra scope of 'offline_access' in your token request, you will then get the refresh token as well..thanks.

Whats the reason for adding the "external" table when you have a similar with AspNetUserLogins from ASPNET Identity?

@rasmuschristensen there is no special reason for that, other than leaving the .NET Identity's table intact..
i'll appreciate a PR..

@waqaskhan540 Thanks for Your work a lot, this is what i needed :-)

@AlexanderButs thanks

Hi. I get an error: "Invalid_client", back from the IdentityServer. I don't seem to have the "external" grant type related to my client. Should I add this manually? Also i did not add my FacebookProvider via the ExternalProvider in the IdentityServer, but like this:

services.AddAuthentication() .AddFacebook("Facebook", options => { options.AppId = "myAppId"; options.AppSecret = "my secret"; options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; })

How do I get the client and Grat type right ?

Regards, Thomas Kristiansen

If I use grant_type: external, i get: unsupported_grant_type back....

@tknuts can you please share your full Authentication configuration in the Startup

I got it working now, thanks though...

@tknuts cheers

hi @waqaskhan540
its great, is there something like this for identity server 3?

@sjdkln
I wrote this specifically in .net core .. its not available for identityserver 3.. but you can follow the code and write one for yourself..

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brockallen picture brockallen  路  3Comments

wangkanai picture wangkanai  路  3Comments

ekarlso picture ekarlso  路  3Comments

leastprivilege picture leastprivilege  路  3Comments

krgm03 picture krgm03  路  3Comments