Accessing Gmail information using DotNetOpenId authentication

I’ve got DotNetOpenId working to log in to Gmail accounts but I’m hitting a roadblock. The only thing I can get is the ClaimedIdentifier. I’m trying to get more info like email addresses or usernames but no luck so far.

Does anyone know how to fetch this extra data from Gmail accounts? I’d really appreciate if someone could share a sample ClaimsRequest setup that works.

I’ve been scratching my head over this for a while now. It seems like it should be possible but I just can’t figure out the right way to do it. Any tips or pointers would be super helpful!

Thanks in advance for any help you can offer. I’m sure other folks working with DotNetOpenId and Gmail might find this useful too.

I’ve encountered this issue before. While DotNetOpenId can be limiting, there’s a workaround. Instead of relying solely on OpenID, consider implementing a hybrid approach using OAuth 2.0 alongside it. This combination allows you to access Gmail’s API more comprehensively.

To achieve this, you’ll need to set up OAuth 2.0 credentials in the Google Developer Console. Once configured, you can use these to request additional scopes during authentication. This method provides access to more user data, including email addresses and profile information.

Remember to clearly communicate to users what data you’re requesting and why. Transparency is key when dealing with personal information. Also, ensure you’re complying with Google’s usage policies and data protection regulations.

hey emma, i had similar issues. try using the google people api instead of openid. it’s way easier to get email and other info. you’ll need to set up oauth2 but it’s worth it. check out their docs, they have good examples. good luck!

I’ve actually been through a similar struggle with DotNetOpenId and Gmail authentication. From my experience, getting more than just the ClaimedIdentifier can be tricky. What worked for me was explicitly requesting additional claims in the OpenID request.

Try adding something like this to your ClaimsRequest:

claimsRequest.Add(WellKnownAttributes.Contact.Email);
claimsRequest.Add(WellKnownAttributes.Name.FullName);

You might also need to set up proper scope for Gmail’s OpenID implementation. Make sure you’re including ‘email’ in your scope.

openid.SetScope(‘openid email’);

Keep in mind that even with these changes, Gmail’s privacy settings might restrict what information is actually shared. Users may need to explicitly allow access to their email address.

If you’re still having trouble after trying these tweaks, you might want to consider using OAuth 2.0 instead. It generally provides more flexibility in accessing user data from Google services.