Reputation: 11
I'm trying to integrate LinkedIn OAuth with Directus, but I keep running into an issue when the authentication callback happens.
Does Directus Support LinkedIn OAuth?
From what I've found, Directus supports OAuth2 authentication, but I haven't seen LinkedIn mentioned specifically. If anyone has successfully integrated LinkedIn OAuth with Directus, please confirm.
{
"errors": [
{
"message": "Service \"oauth2\" is unavailable. Service returned unexpected response: A required parameter \"client_id\" is missing.",
"extensions": {
"service": "oauth2",
"reason": "Service returned unexpected response: A required parameter \"client_id\" is missing",
"code": "SERVICE_UNAVAILABLE"
}
}
]
}
Current settings in LinkedIn developers:
My .env
settings:
AUTH_LINKEDIN_DRIVER="oauth2"
AUTH_LINKEDIN_CLIENT_ID="MY_CLIENT_ID"
AUTH_LINKEDIN_CLIENT_SECRET="MY_CLIENT_SECRET"
AUTH_LINKEDIN_AUTHORIZE_URL="https://www.linkedin.com/oauth/v2/authorization"
AUTH_LINKEDIN_ACCESS_URL="https://www.linkedin.com/oauth/v2/accessToken"
AUTH_LINKEDIN_PROFILE_URL="https://api.linkedin.com/v2/userinfo"
AUTH_LINKEDIN_ALLOW_PUBLIC_REGISTRATION=true
AUTH_LINKEDIN_DEFAULT_ROLE_ID="9a2d0b06-3dd5-4d07-9464-8ad6defce1af"
AUTH_LINKEDIN_SCOPE="email,profile"
AUTH_LINKEDIN_ICON="linkedin"
AUTH_LINKEDIN_LABEL="LinkedIn"
AUTH_LINKEDIN_EMAIL_KEY="email"
http://localhost:8055/auth/login/linkedin
hitting this endpoint
redirecting to LinkedIn auth page
redirected to http://localhost:8055/auth/login/linkedin/callback
and facing Service returned unexpected response: A required parameter "client_id" is missing
I have also take change in node_modules from:
tokenSet = await this.client.oauthCallback(this.redirectUrl, { code: payload['code'], state: payload['state'] }, { code_verifier: payload['codeVerifier'], state: codeChallenge }});
To:
tokenSet = await this.client.oauthCallback(this.redirectUrl, { code: payload['code'], state: payload['state'] }, { code_verifier: payload['codeVerifier'], state: codeChallenge },{exchangeBody:{client_id:"776czrm1do3mid",client_secret:"WPL_AP1.dpyruNgJIBPKB58Z.BElWWw=="}});
Then I got a new error:
{
"errors": [
{
"message": "Service \"oauth2\" is unavailable. Service returned unexpected response: Client authentication failed.",
"extensions": {
"service": "oauth2",
"reason": "Service returned unexpected response: Client authentication failed",
"code": "SERVICE_UNAVAILABLE"
}
}
]
}
So is there any solution for this?
Upvotes: 1
Views: 26