ADringer
ADringer

Reputation: 2834

Using AWS Cognito/Amplify just as an OIDC service

I have an Angular app which I want to secure using AWS Cognito. I initially started using the package angular-oauth2-oidc which worked great, I just gave it a few details (issuer, client_id etc) and was up and running.

I'm now looking at implementing Amplify but am finding the examples are doing much more than I want. The examples and quick start all involve creating resources which I don't want, I just want to redirect to the hosted UI and get a token on response.

Can I use Amplify just to handle the logging in (using hosted UI) and the token? I shouldn't need to create any new resources, my applications aren't hosted in AWS, I just want to use the authentication side of things.

Thanks

Upvotes: 1

Views: 1363

Answers (1)

ege
ege

Reputation: 774

In the amplify documentation it states how to use the Amplify JS Framework with existing AWS ressources.

If you want to use your existing AWS resources with your app you will need to manually configure your app with your current credentials in your code, for example:

import Amplify from 'aws-amplify';

Amplify.configure({
  Auth: {
    // REQUIRED - Amazon Cognito Identity Pool ID
    identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', 
    // REQUIRED - Amazon Cognito Region
    region: 'XX-XXXX-X', 
    // OPTIONAL - Amazon Cognito User Pool ID
    userPoolId: 'XX-XXXX-X_abcd1234',
    // OPTIONAL - Amazon Cognito Web Client ID
    userPoolWebClientId: 'XX-XXXX-X_abcd1234', 
  }
});

Upvotes: 1

Related Questions