Doorkeeper: how to return the user profile information with the callback?

Created on 18 May 2017  路  4Comments  路  Source: doorkeeper-gem/doorkeeper

Hey guys,

how can I return the profile parameter in this case ?
because I get an empty object {}

http://passportjs.org/docs/profile

var passport = require('passport')
  , OAuth2Strategy = require('passport-oauth').OAuth2Strategy;

passport.use('provider', new OAuth2Strategy({
    authorizationURL: 'https://www.provider.com/oauth2/authorize',
    tokenURL: 'https://www.provider.com/oauth2/token',
    clientID: '123-456-789',
    clientSecret: 'shhh-its-a-secret'
    callbackURL: 'https://www.example.com/auth/provider/callback'
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate(..., function(err, user) {
      done(err, user);
    });
  }
));

thank you for your effort.

questiodiscussion

Most helpful comment

I think you want this

All 4 comments

@rasheedhamdawi I can't found how it is connected with Doorkeeper gem?

@nbulaj I am trying to build an account service like Google Accounts and I am using Doorkeeper with Devise.

I have separate service built with NodeJS and I want to implement the authentication with the Account service.

here is the initializer

Doorkeeper.configure do
  orm :active_record

  resource_owner_authenticator do |routes|
    current_user || warden.authenticate!(:scope => :user)
  end

  use_refresh_token
  force_ssl_in_redirect_uri !Rails.env.development?
  grant_flows %w(authorization_code client_credentials)
end

I think you want this

Hi @rasheedhamdawi . If you want to provide more info with the token response, then you need to extend it like @chadwilken said (you need to extend token response like described in the wiki).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reinvanimschoot picture reinvanimschoot  路  5Comments

ianbayne picture ianbayne  路  3Comments

f3ndot picture f3ndot  路  3Comments

eebasadre picture eebasadre  路  4Comments

iangreenleaf picture iangreenleaf  路  4Comments