Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Cognito AWS authentication in Unity WebGL

Discussion in 'WebGL' started by LoopIssuer, Feb 4, 2023.

  1. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    102
    Hi,
    Please tell me - how to make Unity build in WebGL working with Cognito services. As far as I know, there is no SDK for WebGL.
    So how can I implement Cognito functionalities like Login, Refresh Token, Forgot password in Unity WebGL
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    2,436
  3. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    102
    Yes, but this applies to AWS .Net SDK, right?
    My question is - can I use i.e. Cognito API with HTTP requests directly in Unity?
    Or do sth else, but still using Cognito?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    2,436
    If there is a HTTP request api you can use any such service from WebGL using the WebRequest class.
     
  5. FarmerInATechStack

    FarmerInATechStack

    Joined:
    Dec 28, 2020
    Posts:
    24
    @LoopIssuer I might be investigating something similar (but not for WebGL specifically). Are you still working on this too?

    Instead of building my implementation with the SDK, I'm working on a proxy integration using the AWS services and REST endpoints. Alexandre Bruffa seems to have a few tutorials that cover that approach too: https://betterprogramming.pub/how-i-built-a-hotel-platform-with-unity3d-and-aws-22bd3c315d81

    I also plan to check the AWS documentation: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-rest-tutorials.html
     
  6. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    102
    Yes, I ended with BE's endpoints - on the BE we have Cognito SDK.
     
  7. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    343
    The AWS .net libraries don't work in WebGL.
    I used the ones for javascript and let the browser do the communication.
     
  8. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    102
    @manuelgoellnitz
    Could you please explain more about how to use javascript SDK in Unity?
     
  9. FarmerInATechStack

    FarmerInATechStack

    Joined:
    Dec 28, 2020
    Posts:
    24
    I'm not sure what you mean by "BE's endpoints."

    Also, to clarify, I do not mean using SDKs.
     
  10. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    343
    You can call Javascript via Unity and vice versa.
    Now get the aws javascript libraries and implement the login like on a website.
    Then just call them from unity.