Skip to content

Instantly share code, notes, and snippets.

@ricalamino
Created October 4, 2018 20:34
Show Gist options
  • Save ricalamino/d3c7ecf90f3e36635e01d60cb01c9695 to your computer and use it in GitHub Desktop.
Save ricalamino/d3c7ecf90f3e36635e01d60cb01c9695 to your computer and use it in GitHub Desktop.
Login Without Lock for auth0
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