Skip to content

[Question]: Authorizing with Google always gets configured redirectUrl does not match with the current url #2138

@bigbasti

Description

@bigbasti

What Version of the library are you using?
20.0.2

Question
I have set up login using google implicit flow (since code with PKCE is not supported by google) and I always get this when trying to login:

[DEBUG] google - Working with config 'google' using 'https://accounts.google.com'
[DEBUG] google - UrlService.isCallbackFromSts: configured redirectUrl does not match with the current url
[DEBUG] google - currentUrl to check auth with: 'http://localhost:4200/login-success#state=19c04b2ab4807ac6b940191b2cff824e51Lh8TUHE&access_token=ya29.a0AQQ_BDQVC...m7qrd9QWeXLg0207&token_type=Bearer&expires_in=3599&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile%20openid&id_token=eyJhbGciOiJSUzI..._Dj-5lj47Wibbf0w2ak5QsbSn14yUwxkxpd4-Ipw&authuser=0&prompt=none'
[DEBUG] google - checkAuth completed. Firing events now. isAuthenticated: false

My config looks like this:

config: [{
    configId: "microsoft",
    ...
  },
  {
    configId: "google",
    authority: 'https://accounts.google.com',
    redirectUrl: window.location.origin + '/login-success',
    clientId: '9208...1ijohe.apps.googleusercontent.com',
    responseType: 'id_token token',
    scope: 'openid email profile',
    triggerAuthorizationResultEvent: true,
    postLoginRoute: "/",
    postLogoutRedirectUri: window.location.origin + '/unauthorized',
    startCheckSession: false,
    silentRenew: true,
    useRefreshToken: true,
    logLevel: LogLevel.Debug,
    historyCleanupOff: true
  }]

I initiate login using this:

this.oidcSecurityService.authorize("google");

Type of config in google is Web Application with these Redirect URLs (multiple versions just to try)

Image

So why does the check always fail? What do I have to change?
I followed the code example for implicit flow with google in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions