Skip to content

Custom startRedirectPath + callbackUri #179

@alexcroox

Description

@alexcroox

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

It would be useful if there was a way to define the route and callback URI ourselves in runtime, rather than once at boot.

For example if calling from the web I'd want for the callback: https://example.com/login/google/callback

But for my native apps calling the same API I'd use the app identifier appname://login/google/callback

Unless I'm missing something this isn't possible with the current API.

Motivation

Serve both web and native apps with the same code

Example

app.get('/auth/login/google', { schema: oauthGoogleSchema }, async function loginGoogleHandler(request, response) {
  const loginUrl = oauthPlugin.getLoginUrl({
    {
    name: 'googleOAuth2',
    credentials: {
      client: {
        id: '<CLIENT_ID>',
        secret: '<CLIENT_SECRET>'
      },
      auth: oauthPlugin.GOOGLE_CONFIGURATION,
      callbackUri: request.query.callbackUri
    }
  })

  response.redirect(loginUrl)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions