dkh
06/21/2017, 10:39 AMwallslide
06/21/2017, 10:40 AMdkh
06/21/2017, 10:40 AMexport default gql`
mutation ($idToken: String!, $name: String!, $username: String!, $email: String!, $avatar: String!){
createUser(
authProvider: {auth0: {idToken: $idToken}},
name: $name,
username: $username,
email: $email,
avatar: $avatar
) {
id
}
}
`
wallslide
06/21/2017, 10:42 AMwallslide
06/21/2017, 10:42 AMmutation ($firstName: String!, $lastName: String!, $email: String!, $authProvider: AuthProviderSignupData!){
createUser(firstName: $firstName, lastName: $lastName, email: $email, authProvider: $authProvider) {
id,
}
dkh
06/21/2017, 10:43 AMwallslide
06/21/2017, 10:44 AMlock.on('authenticated', (authResult) => {
const {idToken, accessToken, idTokenPayload: {exp}} = authResult;
dkh
06/21/2017, 10:46 AMconst idToken = localStorage.getItem('id_token')
wallslide
06/21/2017, 10:47 AMwallslide
06/21/2017, 10:47 AMdkh
06/21/2017, 10:48 AMhandleAuthentication() {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.setSession(authResult);
} else if (err) {
history.replace('/');
console.log(err);
}
});
}
dkh
06/21/2017, 10:48 AMsetSession(authResult) {
// Set the time that the access token will expire at
let expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime());
localStorage.setItem('access_token', authResult.accessToken);
localStorage.setItem('id_token', authResult.idToken);
localStorage.setItem('expires_at', expiresAt);
localStorage.setItem('authResult', authResult)
// navigate to the home route
history.replace('/authenticate');
}
dkh
06/21/2017, 10:48 AMwallslide
06/21/2017, 10:49 AMnew Auth0Lock(CLIENT_ID, AUTH0_DOMAIN, {});
that the clientId and domain don't match up with the secret that you set in the graphcool dashboard?wallslide
06/21/2017, 10:51 AMdkh
06/21/2017, 10:51 AMdkh
06/21/2017, 10:52 AMwallslide
06/21/2017, 10:52 AMdkh
06/21/2017, 10:53 AMdkh
06/21/2017, 10:57 AMwallslide
06/21/2017, 10:58 AMdkh
06/21/2017, 10:59 AMwallslide
06/21/2017, 10:59 AMwallslide
06/21/2017, 10:59 AMwallslide
06/21/2017, 10:59 AMnilan
06/21/2017, 11:48 AMnilan
06/21/2017, 11:48 AMauth0-js
?dkh
06/21/2017, 11:49 AMnilan
06/21/2017, 11:49 AMdkh
06/21/2017, 11:49 AMnilan
06/21/2017, 11:50 AMdkh
06/21/2017, 11:50 AMpetr.vlcek
06/22/2017, 9:29 AMauth0-js@8.8.0
to implement custom login/signup and I've managed to succesfully implement it with manually parsing id_token
information from URL hash (as parseHash
in v8 cannot parse HS256 tokens yet, as mentioned in https://github.com/auth0/auth0.js/issues/303#issuecomment-273851977)petr.vlcek
06/22/2017, 9:31 AMqs
lib for parsing and something like this:
import qs from 'qs'
let hash = window.location.hash;
hash = hash.replace(/^#?\/?/, '')
const authResult = qs.parse(hash)
if (authResult.error) {
dispatch(signupFailed(authResult))
} else {
dispatch(signupSuccessful(authResult))
}
dkh
06/22/2017, 10:24 AMpetr.vlcek
06/22/2017, 11:07 AMaudience
option for new instance of auth0.WebAuth
or when you turn on OIDC on your Auth0 client (in advanced settings), Auth0 automatically starts sending you RS256 idToken instead of HS256 token regardless of your client JWT signature algorighm settingsdkh
06/22/2017, 12:04 PMpetr.vlcek
06/22/2017, 12:06 PMpetr.vlcek
06/22/2017, 12:06 PMdkh
06/22/2017, 12:08 PMpetr.vlcek
06/22/2017, 12:11 PMdkh
06/22/2017, 12:12 PM