~mna/webparts-auth0

63bcf069b6a856edd2bc27170a50520a2ee0b672 — Martin Angers 3 years ago 2054362 master
attempt to figure out auth
1 files changed, 5 insertions(+), 3 deletions(-)

M auth0.go
M auth0.go => auth0.go +5 -3
@@ 88,7 88,7 @@ func New(ctx context.Context, conf *Config) (*Endpoints, error) {
		ClientSecret: conf.ClientSecret,
		RedirectURL:  conf.OauthCallbackURL,
		Endpoint:     provider.Endpoint(),
		Scopes:       []string{oidc.ScopeOpenID, "profile"}, // TODO: what is this profile?
		Scopes:       []string{oidc.ScopeOpenID, "profile", "email"},
	}

	return &Endpoints{


@@ 139,6 139,8 @@ func (e *Endpoints) Logout(w http.ResponseWriter, r *http.Request) {
	params.Add("client_id", e.oauthConfig.ClientID)
	lurl.RawQuery = params.Encode()

	// TODO: clear session cookie

	http.Redirect(w, r, lurl.String(), http.StatusTemporaryRedirect)
}



@@ 190,9 192,9 @@ func (e *Endpoints) LoginCallback(w http.ResponseWriter, r *http.Request) {

	// TODO: debugging info, print out whatever we received
	b, _ := json.MarshalIndent(idToken, "", "  ")
	fmt.Println(string(b))
	fmt.Println("id token content: >>>>>> \n", string(b))
	b, _ = json.MarshalIndent(profile, "", "  ")
	fmt.Println(string(b))
	fmt.Println("token claims: >>>>>>> \n", string(b))

	// TODO: save session (but what info?)