Created
October 4, 2018 20:34
-
-
Save ricalamino/d3c7ecf90f3e36635e01d60cb01c9695 to your computer and use it in GitHub Desktop.
Login Without Lock for auth0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public loginNoLock(username: string, password: string): void { | |
const postData = { | |
username, | |
password, | |
client_id: environment.Auth0.clientID, | |
connection: 'Username-Password-Authentication', | |
scope: environment.Auth0.scope | |
}; | |
const req = this.http.post('https://' + environment.Auth0.domain + '/oauth/ro', postData, { | |
headers: new HttpHeaders().set('Content-Type', 'application/json') | |
}); | |
req.subscribe((data: any) => { | |
console.log(data); | |
const userinfoReq = this.http.get(environment.Auth0.audience, { | |
headers: new HttpHeaders().set('Authorization', 'Bearer ' + data.access_token)}); | |
userinfoReq.subscribe((data_user: any) => { | |
console.log(data_user); | |
this.runAutentication(data, data_user); | |
}); | |
}, err => { | |
console.log(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment