vue-authenticate icon indicating copy to clipboard operation
vue-authenticate copied to clipboard

Needed State Parameter [Github]

Open orlyyani opened this issue 7 years ago • 3 comments

param

After logging in in the Gihub, it's asking for the parameter state which the plugin doesn't sends.

orlyyani avatar Jan 19 '18 10:01 orlyyani

Hi @orlyyani,

is state being sent to Github when you are doing authentication?

If no, you might need to specify state as optional parameter in your provider configuration, like this:

  providers: {
    github: {
      clientId: '...',
      redirectUri: 'http://localhost:8080/auth/callback',
      state: function () { 
        return new Date().getTime().toString();
      },
      optionalUrlParams: ['scope', 'state']
    }
  }

If state is only not being sent in POST request going to your server, then this might be the issue: https://github.com/dgrubelic/vue-authenticate/blob/master/src/oauth/oauth2.js#L43

Make sure your state is either a string or a function returning a string.

dgrubelic avatar Jan 28 '18 13:01 dgrubelic

I had the same issue, could this configuration added to readme or something, it wasn't the obvious how to use that state and get it shown in the request url.

hytonevi avatar Nov 20 '18 13:11 hytonevi

I'm having issue with facebook provided where I'm setting state similarly to how it explained above it still not presented in facebook popup window? Is that a known issue?

cr0ss avatar Feb 13 '19 14:02 cr0ss