question

PlasticTrees-5315 avatar image
0 Votes"
PlasticTrees-5315 asked AndrewBrown-7911 answered

Rails: Implementing B2C to web app

I'm developing a web application using Ruby (2.6.2) and Rails (5.2.3).

I've successfully deployed it to App Service. Therefore, I'm now looking to implement an auth solution.

I'm developing a product manager webpage. Where users can add/edit/remove their products.

I can't find any documentation on Ruby and B2C. However, I've found this git, which is a controller for Azure AD auth. Will this work with B2C?

Can Ruby be recommended with B2C? As I want to make sure my auth is secure as possible. Will solutions with Azure AD also work with B2C? (Like the one above).


azure-webappsazure-ad-b2cazure-ad-app-development
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PlasticTrees-5315,

I don't see why you couldn't use B2C. I don't know much about the oauth2 Ruby library but from what I could tell, it should work by updating AUTHORIZE_URL and RESOURCE_ID to your B2C tenant. https://docs.microsoft.com/en-us/azure/active-directory-b2c/authorization-code-flow explains the OAuth flow for implementing B2C. There's also an Azure SDK for Ruby which includes a package for Microsoft Graph. You can use that SDK as a reference since that repo is no longer maintained. If you run into issues, please comment below and I'll do my best to assist.

Furthermore, I will work with our content team to address the gaps in our documentation and see about getting Ruby samples added to our Azure Samples repo.

Regards,
Ryan


1 Vote 1 ·

Thanks Ryan, I'll get to work on it and let you know how it goes.

I'll be happy to contact them directly or provide more information on how the docs could be better. As I've used Firebase and AWS and know where your docs could be better.

Thanks for your help,

Toby.



0 Votes 0 ·
alfredorevilla-msft avatar image
0 Votes"
alfredorevilla-msft answered

Hello @plastictrees-5315, there a couple of OAuth2 client libraries for Ruby out there which may work with Azure B2C provided they accept a scope parameter. Take a look here and here.

Please let me know if you need more help. If the answer was helpful to you, please accept it and optionally fill the feedback form it so that other members in the community can benefit from it.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndrewBrown-7911 avatar image
0 Votes"
AndrewBrown-7911 answered

The Azure documentation contains instructions on how to install Azure BC2 as part of a Ruby on Rails application.

https://docs.microsoft.com/en-us/graph/tutorials/ruby?WT.mc_id=Portal-Microsoft_AAD_RegisteredApps

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.