Skip to content

How to add email claim using oidc_user_claims ? #91

Description

@funkypenguin

Hey folks!

I'm trying to use this in conjection with https://github.com/mesosphere/traefik-forward-auth - I need an email claim to validate, so I tried the following client setup:

add_filter( 'oidc_registered_clients', 'my_oidc_clients' );
function my_oidc_clients() {
	return array(
		'clientid' => array(
			'name' => 'My Awesome Name',
			'secret' => 'clientsecret',
			'grant_types' => array( 'authorization_code' ),
			'scope' => 'openid profile email'
		),
	);
}

And then I added:

add_filter( 'oidc_user_claims', 'my_user_claims', 10, 2 );
function my_user_claims($claims, $user) {
    $claims['email'] = $user->user_email; 
    return $claims;
}

Hoping to get the email address returned. However, my claim (when debugged with https://openidconnect.net/), doesn't show the email field.

Have I misunderstood how to achieve this? :)

Thanks!
D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions