go-oidc icon indicating copy to clipboard operation
go-oidc copied to clipboard

Add Scope value predefined in the specification (profile, email, address, phone)

Open arukiidou opened this issue 2 years ago • 2 comments

Summary

If I open this PR, is it acceptable?

Citation of specifications

https://openid.net/specs/openid-connect-core-1_0.html

5.4.  Requesting Claims using Scope Values
profile
OPTIONAL. This scope value requests access to the End-User's default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.
email
OPTIONAL. This scope value requests access to the email and email_verified Claims.
address
OPTIONAL. This scope value requests access to the address Claim.
phone
OPTIONAL. This scope value requests access to the phone_number and phone_number_verified Claims.

Key changes.

  • Omit examples and document updates yet - if you favor this proposal, I will start.

const (
	ScopeProfile = "profile"
	ScopeEmail = "email"
	ScopeAddress = "address"
	ScopePhone = "phone"
)

Anticipated Questions

        // before
	config := oauth2.Config{
		Scopes:       []string{oidc.ScopeOpenID, "profile", "email"},
	}
        // after
	config := oauth2.Config{
		Scopes:       []string{oidc.ScopeOpenID, oidc.ScopeProfile, oidc.ScopeEmail},
	}

arukiidou avatar Aug 14 '23 15:08 arukiidou

Yeah this sounds reasonable, feel free to send a PR!

ericchiang avatar Aug 15 '23 04:08 ericchiang

@ericchiang

  • Thanks! I did it #387

arukiidou avatar Aug 15 '23 14:08 arukiidou