Hi!
I’m trying to authenticate at Github using an OAuth provider. When requesting credentials using
const github = api.asUser().withProvider('github', 'github-api');
if (!(await github.hasCredentials())) {
await github.requestCredentials();
}
I get this error:
[NEEDS_AUTHENTICATION_ERR: Authentication Required] {
status: 401,
serviceKey: 'github',
options: { scopes: undefined, isExpectedError: true }
This sounds like the client secret might be missing, but I have set it up using
forge providers configure
. My provider definition looks like this:
providers:
auth:
- key: github
name: Github
remotes:
- github-base
- github-api
scopes:
- repo
- user
type: oauth2
clientId: ***
bearerMethod:
type: authorization-header
actions:
authorization:
remote: github-base
path: /login/oauth/authorize
exchange:
remote: github-base
path: /login/oauth/access_token
resolvers:
accessToken: access_token
retrieveProfile:
remote: github-api
path: /user
resolvers:
id: id
displayName: login
remotes:
- key: github-api
baseUrl: https://api.github.com
- key: github-base
baseUrl: https://github.com
permissions:
external:
fetch:
backend:
- https://github.com
- https://api.github.com
Anyone who can you help me to figure out what the problem is?
Thanks!