Skip to content

Document all providers options #241

@ajmas

Description

@ajmas

Currently the 'provider' properties aren't documented, so some documentation should be added. In the meantime, for anyone else:

A number of providers are already provided, with the properties passed via the providers section of the options overriding the base values. This mean we can use this section to provide a new provider, such as for Discord:

app.use(VueAuthenticate, {
    baseUrl: 'http://localhost:1234', // Your API domain

    providers: {
      discord: {
        // ##specific configuration for your client ##

        // the client id provided for you client, by your OAuth provider
        clientId: '0000000000',
        // where the oauth server should redirect to, after successfully authenticating
        redirectUri: 'http://localhost:8080/account/linked-accounts', // Your client app URL

        // ## general configuration for the provider ##

        // the name of the provider, in lower case, suitable for use as a property
        name: 'discord',
        // url appended to the baseUrl, when sending response base to your API server
        url: '/auth/discord',
        // the authorisation endpoint
        authorizationEndpoint: 'https://discord.com/api/oauth2/authorize',
        // which params are included in the URL
        requiredUrlParams: ['display', 'scope'],
        // what is being asked of the oauth provider in terms of extra information, beyond id
        scope: ['email'],
        scopeDelimiter: ',',
        // indicate whether to be shown in a pop-up (appears to be ignore and be pop-up always)
        display: 'popup',
        // indicates the oauth type to be used. Either 1.0 or 2.0
        oauthType: '2.0',
        // controls the size of the pop up window
        popupOptions: { width: 580, height: 700 }
      }
    }
  });

BTW usually best to request the smallest scope possible, and then only add supplementary scopes if it makes sense. Consider the balance of what you need to know about the user, with the user's desire for privacy.

Note, at the time of writing it does not seem possible to prevent the OAuth screen being shown in a pop-up.

Docs on Discord OAuth: https://discord.com/developers/docs/topics/oauth2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions