Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do you get the access_token? #14

Closed
mankins opened this issue May 20, 2016 · 7 comments
Closed

how do you get the access_token? #14

mankins opened this issue May 20, 2016 · 7 comments

Comments

@mankins
Copy link

mankins commented May 20, 2016

I'm writing a custom provider, and looking at how to get access to the access_token in the callback respones. It looks buried in serverless-authentication which seems to return a profile, but no access_token. But maybe I'm missing something?

@laardee
Copy link
Owner

laardee commented May 20, 2016

Yes, the authentication flow is buried to the provider class https://github.com/laardee/serverless-authentication/blob/master/src/provider.js. How are you planning to use the access_token later on?

@mankins
Copy link
Author

mankins commented May 20, 2016

I was planning on making subsequent api calls once the initial flow has been started. I'd use the auth'd api from within the lambda function/app later on. Which would require access to the token.

@laardee
Copy link
Owner

laardee commented May 20, 2016

I don't see a reason why it couldn't be returned along with the profile. I added it to provider class and it will be available in _raw (profile._raw.access_token). I'll do some other improvements before I publish this to npm, but i'll try to do that as soon as possible.

@mankins
Copy link
Author

mankins commented May 20, 2016

thanks!

@laardee
Copy link
Owner

laardee commented May 21, 2016

In serverless-authentication v.0.4.4 (in npm) access_token is mapped as profile.at_hash as defined in OpenId standard (instead of profile._raw.access_token). I decide to use that because I've started to implement some Cognito features (#8 and #9) which uses OpenId fields.

@nishtha3006
Copy link

Heyy i tried to install the project but it is giving me error.I tried to figure it out but no clue.
Can you help me with this??

npm ERR! Linux 3.19.0-58-generic
npm ERR! argv "/home/nishtha/.nvm/versions/node/v4.3.2/bin/node" "/home/nishtha/.nvm/versions/node/v4.3.2/bin/npm" "install"
npm ERR! node v4.3.2
npm ERR! npm v2.14.12
npm ERR! path /home/nishtha/.npm/lodash/4.13.0
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/home/nishtha/.npm/lodash/4.13.0'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/home/nishtha/.npm/lodash/4.13.0']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/home/nishtha/.npm/lodash/4.13.0',
npm ERR! parent: 'async' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /tmp/__sls_project_install_serverless-authentication-boilerplate_1463997196535/node_modules/serverless-authentication-boilerplate/authentication/npm-debug.log
npm ERR! Linux 3.19.0-58-generic
npm ERR! argv "/home/nishtha/.nvm/versions/node/v4.3.2/bin/node" "/home/nishtha/.nvm/versions/node/v4.3.2/bin/npm" "install" "serverless-authentication-boilerplate"
npm ERR! node v4.3.2
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! serverless-authentication-boilerplate@0.6.3 install: cd authentication && npm install && cd ../authorization && npm install
npm ERR! Exit status 243
npm ERR!
npm ERR! Failed at the serverless-authentication-boilerplate@0.6.3 install script 'cd authentication && npm install && cd ../authorization && npm install'.
npm ERR! This is most likely a problem with the serverless-authentication-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cd authentication && npm install && cd ../authorization && npm install
npm ERR! You can get their info via:
npm ERR! npm owner ls serverless-authentication-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /tmp/__sls_project_install_serverless-authentication-boilerplate_1463997196535/npm-debug.log
]
killed: false,
code: 1,
signal: null,
cmd: '/bin/sh -c npm install serverless-authentication-boilerplate' },
isOperational: true,
killed: false,
code: 1,
signal: null,
cmd: '/bin/sh -c npm install serverless-authentication-boilerplate' }

@laardee
Copy link
Owner

laardee commented May 23, 2016

@nishtha3006 you could create a new issue about this, but I guess the problem could be the npm install script. You could remove

"install": "cd authentication && npm install && cd ../authorization && npm install",

from package json. Then run npm install (maybe with sudo in your case?) in project root, authentication and authorization folders.

@mankins mankins closed this as completed Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants