-
-
Notifications
You must be signed in to change notification settings - Fork 123
Client Access Resource
nov edited this page Jan 5, 2015
·
3 revisions
Once you got an access token, how to use it is out of openid_connect gem's scope.
Use rack-oauth2 gem for such purpose.
OpenIDConnect::AccessToken
class is provided for UserInfo API access.
client = OpenIDConnect::Client.new(
identifier:'client_id',
host: 'server.example.com'
)
access_token = OpenIDConnect::AccessToken.new(
access_token: 'access_token',
client: client
)
userinfo = access_token.userinfo! # => OpenIDConnect::ResponseObject::UserInfo instance
Since UserInfo API is one of OAuth2 protected resources, you can simply use rack-oauth2 gem for the API access.
In that case, it'll returns a JSON object (Hash
in Ruby), instead of OpenIDConnect::ResponseObject::UserInfo
instance.
Choose whichever you prefer.